#pragma pack_matrix(row_major)


cbuffer VRAM : register(b0)
{
	float4x4 world;
	float4x4 view;
	float4x4 proj;

	float4 color;

	float scale;
	float alpha;

	float padding[2];
}

struct gs_in
{
	float3 position : POSITION;
};

struct gs_out
{
	float4 position : SV_POSITION;
	float4 color	: COLOR;
	float2 texCoord : TEXCOORD;
};

[maxvertexcount(6)]
void main(point gs_in vertex[1], inout TriangleStream<gs_out> output)
{
	// find position relitive to camera
	float4 position = float4(vertex[0].position, 1.f);

	// find the size
	float size = scale / 2.f;

	// allocate some vertecies
	gs_out vertecies[] =
	{
		position + float4(-size, size, 0.f, 0.f), color * alpha, float2(0.f, 0.f),
		position + float4(size, -size, 0.f, 0.f), color * alpha, float2(1.f, 1.f),
		position + float4(-size, -size, 0.f, 0.f), color * alpha, float2(0.f, 1.f),
		position + float4(-size, size, 0.f, 0.f), color * alpha, float2(0.f, 0.f),
		position + float4(size, size, 0.f, 0.f), color * alpha, float2(1.f, 0.f),
		position + float4(size, -size, 0.f, 0.f), color * alpha, float2(1.f, 1.f),
	};

	float4x4 wv = mul(world, view);
		float4x4 wvp = mul(wv, proj);

	for (int i = 0; i < 6; i++)
	{
		// compute screen position
		vertecies[i].position = mul(vertecies[i].position, wvp);
		// output this vertex
		output.Append(vertecies[i]);
	}
}